///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                            //
//                                                         WNProject                                                          //
//                                                                                                                            //
//            This file is distributed under the BSD 2-Clause open source license. See License.txt for details.               //
//                                                                                                                            //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef __WN_WRITE_TEXT_FILE_BUFFER_H__
#define __WN_WRITE_TEXT_FILE_BUFFER_H__

#include "WNFileIO/inc/WNFileBuffer.h"
#include "WNFileIO/inc/WNFile.h"

namespace WNFileIO {
    class WNWriteTextFileBuffer : public WNFileBuffer {
        public:
            WNWriteTextFileBuffer(WNFileBufferType _type, WN_SIZE_T _initialBufferSize = 1024*1024);
            virtual ~WNWriteTextFileBuffer();
            virtual WN_BOOL Serialize(WN_UINT32 _flags, const WNContainers::WNSerializerBase& _serializer);
            virtual WNFile::WNFileError SetFile(const WN_CHAR* fileName);
            virtual WN_CHAR* ReserveBytes(WN_SIZE_T _numBytes, WN_SIZE_T& _returnedBytes);
            virtual WNContainers::WNDataBufferType GetType();

        private:
            WN_BOOL DumpToFile();
            WNFile mFile;
            WN_CHAR* mCurrentBuff;
            WN_SIZE_T mBuffUsage;
            WN_SIZE_T mBuffSize;
    };
}

#endif // __WN_WRITE_TEXT_FILE_BUFFER_H__
